<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
        
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/jquery.min.js?ver=<?= $config['version'] ?>"></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.common.core.js" ></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.line.js" ></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.common.dynamic.js" ></script>	
		<script type="text/javascript" src="<?= $config['res_url']?>/js/rgraph/libraries/RGraph.bar.js"></script>

	
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
        
        
        
        <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
     <tr>
       </center><td><!--&nbsp;
       <center>
       	 渠道名字 :<?=$channel ?>&nbsp;&nbsp;
       	平台:<?=$platform ?>&nbsp;&nbsp;
       	系统版本:<?=$osver ?>&nbsp;&nbsp;
       	联网类型:<?=$network ?>&nbsp;&nbsp;
       	设备类型:<?=$device ?>&nbsp;&nbsp;
       	游戏版本:<?=$gamever ?>&nbsp;&nbsp;
       &nbsp;&nbsp;
       	开始时间:<?= $startTime ?> &nbsp;&nbsp;
       	结束时间:<?= $endTime ?></center>--></td>
     </tr>
     
     
     <tr>
       <td>
     
       <table border='1'>
       <tr>
       		<?php
     		$tmpvalue = "";
     		//$orangegem = "";
     		//$redgem = "";
    		$labels = "";
      		?>
       		<td>日期</td>
       <?php foreach ($othergraph as $key=>$value) {?>
       		<td>&nbsp;<?=$key ?></td>  
       		<?php 
       		$key = str_replace("-", ".", $key);
       		$labels .= "'".$key."'".",";
       		//print_r($labels);
			}?>    		
       </tr>

      
  		 <tr>
       		<td>服务器橙色宝石总量</td>
       <?php foreach ($othergraph as $key=>$value) {?>
       		<td>&nbsp; <?=$value['orange_gem'] ?></td>  
       		
       		<?php 
       		//$orangegem .= $value['orange_gem'].",";
       		//print_r($equipsmelt);
			}?> 		
       </tr>
   
       <tr>
       		<td>服务器红色宝石总量</td>
       <?php foreach ($othergraph as $key=>$value) {?>
       		<td>&nbsp; <?=$value['red_gem'] ?></td>  
       		
       		<?php 
       		//$redgem .= $value['red_gem'].",";
       		//print_r($orangeequip);
			}?> 		
       </tr>
       <?php 
         	$labels = substr($labels, 0, -1);
         	//$orangegem = substr($orangegem, 0, -1);
         	//$redgem = substr($redgem, 0, -1);
         	//var_dump($labels);
         	//var_dump($threestarpet);
         	//exit(0);
         	?>
         	<?php 
         		foreach ($othergraph as $key=>$value)
         		{
         			$tmpvalue .= "[".$value['orange_gem'].",".$value['red_gem']."]".",";
         		}
         		$tmpvalue = substr($tmpvalue, 0, -1);
         	?>
       </table>
       
       </td>
     </tr>
   </table>
        
        <canvas id="cvs" width="1700" height="500" style="border: 1px solid #ddd">[No canvas support]</canvas>
        
        <form action="" method="POST" id="rowForm">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
            
  <!--           <tr><td><?= translate('MESSAGE_CRASHREPORT_CHANNEL') ?>:</td>
            		<td><select name="row[channel]" id="channel">
                      	<option value="all">all</option>
                      	<?php foreach ($channelList as $key => $value) {?>
            		    <option value="<?=$key ?>" <?php if($value == $channel) echo "selected";?> ><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>
   		        
   		        <tr><td><?= translate('MESSAGE_FENXIREPORTGRAPH_PLATFORM') ?>:</td>
            		<td><select name="row[platform]" id="platform">
                      	<option value="all">all</option>
                      	<?php foreach ($platformList as $key => $value) {?>
            		    <option value="<?=$key ?>" <?php if($value == $platform) echo "selected";?> ><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>
   		        
   		        <tr><td><?= translate('MESSAGE_FENXIREPORTGRAPH_OSVER') ?>:</td>
            		<td><select name="row[osver]" id="osver">
                      	<option value="all">all</option>
                      	<?php foreach ($osverList as $key => $value) {?>
            		    <option value="<?=$key ?>" <?php if($value == $osver) echo "selected";?> ><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>
   		        
   		        <tr><td><?= translate('MESSAGE_FENXIREPORTGRAPH_NETWORK') ?>:</td>
            		<td><select name="row[network]" id="network">
                      	<option value="all">all</option>
                      	<?php foreach ($networkList as $key => $value) {?>
            		    <option value="<?=$key ?>" <?php if($value == $network) echo "selected";?> ><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>
   		        
   		        <tr><td><?= translate('MESSAGE_FENXIREPORTGRAPH_DEVICE') ?>:</td>
            		<td><select name="row[device]" id="device">
                      	<option value="all">all</option>
                      	<?php foreach ($deviceList as $key => $value) {?>
            		    <option value="<?=$key ?>" <?php if($value == $device) echo "selected";?> ><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>
   		        
   		        <tr><td><?= translate('MESSAGE_FENXIREPORTGRAPH_GAMEVER') ?>:</td>
            		<td><select name="row[gamever]" id="gamever">
                      	<option value="all">all</option>
                      	<?php foreach ($gameverList as $key => $value) {?>
            		    <option value="<?=$key ?>" <?php if($value == $gamever) echo "selected";?> ><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>   	-->
            
            <tr><td><?= translate('STARTTIME') ?>:</td><td><input type='text' name='row[starttime]' id='starttime' class='datepicker' value="<?= $startTime ?>"/></td></tr>
                <tr><td><?= translate('ENDTIME') ?>:</td><td><input type="text" name="row[endtime]" id="endtime" class='datepicker'  value="<?= $endTime ?>"/></td></tr>
                <tr><td>选择分区:</td>
            		<td><select name="row[area]" id="area">
                      	<?php foreach ($areaList as $key => $value) {?>
            		    <option value="<?=$key ?>"><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>
                <tr><td></td><td>
	                <input type="submit" value="<?= translate('SHENGCHENG') ?>" id="submit"/> 
                </td></tr>
            </table>
   		</form>
   		
   		
   		
   		<script>
   		
    	        
    $(document).ready(
				function()
				{
					var line = new RGraph.Bar('cvs', /*[<?= $orangegem?>], [<?= $redgem?>]*/[<?= $tmpvalue?>]);
					line.Set("chart.title", "服务器宝石数据柱状图");
					line.Set("chart.title.xaxis", "X轴/日期");  //指定x轴标题
			        line.Set("chart.title.yaxis", "Y轴/总量"); //指定y轴标题
			        //line.Set('chart.key', ['存量', '产量', '消耗量']);
			        line.Set('chart.gutter.left', 100);
			        line.Set('chart.gutter.right', 50);
			        line.Set('chart.gutter.top', 50);
			        line.Set('chart.gutter.bottom', 50);
			        line.Set('chart.colors', ['yellow', 'red']);
			        //line.Set('chart.colors', ['red', 'green', 'blue']);
			        //line.Set('chart.key', ['总存量','总产量','总消耗']);
			        //line.Set('chart.key.position', 'gutter');
		            //line.Set('chart.key.position.gutter.boxed', false);
		            //line.Set('chart.key.position.x', 1000);
		            
					line.Set("chart.labels", [<?= $labels?>]);   //不能写成<?php ?>被坑死了！
					line.Set("chart.labels.above", true);
					line.Draw();
				}
    	    )
    	        
   	
    </script>
    <script type="text/javascript">
            SG.init("core.form", function() {
                $.formValidator.initConfig({formid: "#rowForm", submitonce: true});
                $("#starttime").formValidator({empty: false, onshow: '<?= translate('PLASE_WRITE') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                $("#endtime").formValidator({empty: false, onshow: '<?= translate('PLASE_WRITE') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                //$("#platform").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                //$("#game").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});  
                //$("#server").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});                  
                //$("#type").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
            });
        </script>
   		
   		
   </body>
 </html>